n = int(input())
e = list(map(int, input().split()))
m = int(input())
v = list(map(int, input().split()))
ans = 0
for i in e:
    n_e = e.pop(0)
    for j in v:
        n_v = v.pop(0)
        if n_e <= n_v:
            ans += 1
        if not v:
            break
    if not e:
        break

print(ans)
        
